<%@ page import="java.util.List" %>
<%@ page import="top.lionkliu.service.impl.NoteServiceImpl" %>
<%@ page import="top.lionkliu.entity.User" %>
<%@ page import="top.lionkliu.entity.Note" %>
<%@ page import="top.lionkliu.utils.SystemConstants" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>search</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../static/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="../static/bootstrap/css/bootstrap.min.css">

    <script src="../static/js/jquery.js"></script>
    <script src="../static/bootstrap/js/bootstrap.js"></script>
</head>
<body>

<%@include file="../common/NavBar.jsp" %>


<%
    //List<Note> notes = (List<Note>) request.getAttribute("search");
    String key = request.getParameter("selectedValue");
    String value = request.getParameter("inputValue");
    NoteServiceImpl noteService = new NoteServiceImpl();
    List<Note> notes = noteService.selectByLike(key, value);
    request.setAttribute("search", notes);
%>
<div class="container">
    <h1 style="margin: 10px">根据<span style="color:#f06292 "><%=key%></span>搜索<span
            style="color:#f06292 "><%=value%></span>的结果<small></small></h1>
    <table class="table table-bordered text-center">
        <tr class="table-primary">
            <th>编号</th>
            <th>标题</th>
            <th>作者</th>
            <th>内容</th>
            <th>操作</th>
        </tr>
        <%
            for (Note note : notes) {
        %>
        <tr>
            <td><%=note.getId()%>
            </td>
            <td><%=note.getTitle()%>
            </td>
            <td><%=note.getAuthor()%>
            </td>
            <td><%=note.getContent()%>
            </td>

            <td>
                <a href="javascript:void(0)" onclick="del(<%=note.getId()%>)">删除</a>
                <a href="<%=request.getContextPath()%>/note/edit_note.jsp?id=<%=note.getId()%>">修改</a>
            </td>


        </tr>
        <%
            }
        %>
    </table>
</div>


</body>
</html>
